import { request } from '../utils/request'
import type {
  AlarmData,
  AlarmStats,
  AlarmSearchParams,
  PaginatedResponse,
  AlarmDistribution,
  AlarmTrend
} from '../types/alarm'

// 获取告警列表
export function getAlarms(params: AlarmSearchParams) {
  return request.get<PaginatedResponse<AlarmData>>('/alarms', { params })
}

// 获取告警统计
export function getAlarmStats() {
  return request.get<AlarmStats>('/alarms/stats')
}

// 获取告警分布
export function getAlarmDistribution() {
  return request.get<Record<string, AlarmDistribution[]>>('/alarms/distribution')
}

// 获取告警趋势
export function getAlarmTrend() {
  return request.get<AlarmTrend>('/alarms/trend')
}

// 更新告警状态
export function updateAlarmStatus(alarmId: string, status: string) {
  return request.put<void>(`/alarms/${alarmId}/status`, { status })
} 